package com.ruoyi.app.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.app.domain.vo.DebtRecordsVo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MybatisUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.DebtRecordsFileMapper;
import com.ruoyi.app.domain.DebtRecordsFile;
import com.ruoyi.app.service.IDebtRecordsFileService;

/**
 * 供应商信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-29
 */
@Service
public class DebtRecordsFileServiceImpl extends ServiceImpl<DebtRecordsFileMapper, DebtRecordsFile> implements IDebtRecordsFileService
{
    @Autowired
    private DebtRecordsFileMapper debtRecordsFileMapper;

    /**
     * 查询供应商信息
     * 
     * @param id 供应商信息主键
     * @return 供应商信息
     */
    @Override
    public DebtRecordsFile selectDebtRecordsFileById(String id)
    {
        return baseMapper.selectById(id);
    }

    /**
     * 查询供应商信息列表
     * 
     * @param debtRecordsFile 供应商信息
     * @return 供应商信息
     */
    @Override
    public List<DebtRecordsFile> selectDebtRecordsFileList(DebtRecordsFile debtRecordsFile)
    {
        return MybatisUtils.list(baseMapper, debtRecordsFile);
    }

    @Override
    public void deleteByRecordsId(String recordsId) {
        if(StringUtils.isBlank(recordsId)){
            return;
        }
        LambdaQueryWrapper<DebtRecordsFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(DebtRecordsFile::getDebtRecordsId, recordsId);
        baseMapper.delete(lambdaQueryWrapper);
    }

    @Override
    public List<DebtRecordsFile> selectByRecordsId(String recordsId) {
        if(StringUtils.isBlank(recordsId)){
            return null;
        }
        LambdaQueryWrapper<DebtRecordsFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(DebtRecordsFile::getDebtRecordsId, recordsId);
        lambdaQueryWrapper.orderByAsc(DebtRecordsFile::getSort);
        return baseMapper.selectList(lambdaQueryWrapper);
    }
}
